Optimal. Leaf size=170 \[ \frac {1}{8} \left (8 a A b+4 a^2 B+3 b^2 B\right ) x+\frac {\left (4 a^2 A b+4 A b^3-a^3 B+8 a b^2 B\right ) \sin (c+d x)}{6 b d}+\frac {\left (8 a A b-2 a^2 B+9 b^2 B\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {(4 A b-a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 b d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.15, antiderivative size = 170, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {3047, 3102,
2832, 2813} \begin {gather*} \frac {\left (-2 a^2 B+8 a A b+9 b^2 B\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac {1}{8} x \left (4 a^2 B+8 a A b+3 b^2 B\right )+\frac {\left (a^3 (-B)+4 a^2 A b+8 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 b d}+\frac {(4 A b-a B) \sin (c+d x) (a+b \cos (c+d x))^2}{12 b d}+\frac {B \sin (c+d x) (a+b \cos (c+d x))^3}{4 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2813
Rule 2832
Rule 3047
Rule 3102
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx &=\int (a+b \cos (c+d x))^2 \left (A \cos (c+d x)+B \cos ^2(c+d x)\right ) \, dx\\ &=\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}+\frac {\int (a+b \cos (c+d x))^2 (3 b B+(4 A b-a B) \cos (c+d x)) \, dx}{4 b}\\ &=\frac {(4 A b-a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 b d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}+\frac {\int (a+b \cos (c+d x)) \left (b (8 A b+7 a B)+\left (8 a A b-2 a^2 B+9 b^2 B\right ) \cos (c+d x)\right ) \, dx}{12 b}\\ &=\frac {1}{8} \left (8 a A b+4 a^2 B+3 b^2 B\right ) x+\frac {\left (4 a^2 A b+4 A b^3-a^3 B+8 a b^2 B\right ) \sin (c+d x)}{6 b d}+\frac {\left (8 a A b-2 a^2 B+9 b^2 B\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {(4 A b-a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 b d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.51, size = 118, normalized size = 0.69 \begin {gather*} \frac {12 \left (8 a A b+4 a^2 B+3 b^2 B\right ) (c+d x)+24 \left (4 a^2 A+3 A b^2+6 a b B\right ) \sin (c+d x)+24 \left (2 a A b+a^2 B+b^2 B\right ) \sin (2 (c+d x))+8 b (A b+2 a B) \sin (3 (c+d x))+3 b^2 B \sin (4 (c+d x))}{96 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 152, normalized size = 0.89
method | result | size |
derivativedivides | \(\frac {a^{2} A \sin \left (d x +c \right )+B \,a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 A a b \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {2 B a b \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+\frac {A \,b^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+B \,b^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) | \(152\) |
default | \(\frac {a^{2} A \sin \left (d x +c \right )+B \,a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 A a b \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {2 B a b \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+\frac {A \,b^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+B \,b^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) | \(152\) |
risch | \(x A a b +\frac {a^{2} B x}{2}+\frac {3 b^{2} B x}{8}+\frac {\sin \left (d x +c \right ) a^{2} A}{d}+\frac {3 \sin \left (d x +c \right ) A \,b^{2}}{4 d}+\frac {3 \sin \left (d x +c \right ) B a b}{2 d}+\frac {B \,b^{2} \sin \left (4 d x +4 c \right )}{32 d}+\frac {\sin \left (3 d x +3 c \right ) A \,b^{2}}{12 d}+\frac {\sin \left (3 d x +3 c \right ) B a b}{6 d}+\frac {\sin \left (2 d x +2 c \right ) A a b}{2 d}+\frac {\sin \left (2 d x +2 c \right ) B \,a^{2}}{4 d}+\frac {\sin \left (2 d x +2 c \right ) B \,b^{2}}{4 d}\) | \(170\) |
norman | \(\frac {\left (A a b +\frac {1}{2} B \,a^{2}+\frac {3}{8} B \,b^{2}\right ) x +\left (A a b +\frac {1}{2} B \,a^{2}+\frac {3}{8} B \,b^{2}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 A a b +2 B \,a^{2}+\frac {3}{2} B \,b^{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 A a b +2 B \,a^{2}+\frac {3}{2} B \,b^{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (6 A a b +3 B \,a^{2}+\frac {9}{4} B \,b^{2}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (8 a^{2} A -8 A a b +8 A \,b^{2}-4 B \,a^{2}+16 B a b -5 B \,b^{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (8 a^{2} A +8 A a b +8 A \,b^{2}+4 B \,a^{2}+16 B a b +5 B \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {\left (72 a^{2} A -24 A a b +40 A \,b^{2}-12 B \,a^{2}+80 B a b +9 B \,b^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {\left (72 a^{2} A +24 A a b +40 A \,b^{2}+12 B \,a^{2}+80 B a b -9 B \,b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(362\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 142, normalized size = 0.84 \begin {gather*} \frac {24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2} + 48 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a b - 64 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a b - 32 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A b^{2} + 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{2} + 96 \, A a^{2} \sin \left (d x + c\right )}{96 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 114, normalized size = 0.67 \begin {gather*} \frac {3 \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} d x + {\left (6 \, B b^{2} \cos \left (d x + c\right )^{3} + 24 \, A a^{2} + 32 \, B a b + 16 \, A b^{2} + 8 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 338 vs.
\(2 (162) = 324\).
time = 0.22, size = 338, normalized size = 1.99 \begin {gather*} \begin {cases} \frac {A a^{2} \sin {\left (c + d x \right )}}{d} + A a b x \sin ^{2}{\left (c + d x \right )} + A a b x \cos ^{2}{\left (c + d x \right )} + \frac {A a b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{d} + \frac {2 A b^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {A b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {B a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {4 B a b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {2 B a b \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 B b^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 B b^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {5 B b^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\left (c \right )}\right ) \left (a + b \cos {\left (c \right )}\right )^{2} \cos {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.42, size = 124, normalized size = 0.73 \begin {gather*} \frac {B b^{2} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {1}{8} \, {\left (4 \, B a^{2} + 8 \, A a b + 3 \, B b^{2}\right )} x + \frac {{\left (2 \, B a b + A b^{2}\right )} \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {{\left (B a^{2} + 2 \, A a b + B b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \sin \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.51, size = 169, normalized size = 0.99 \begin {gather*} \frac {B\,a^2\,x}{2}+\frac {3\,B\,b^2\,x}{8}+\frac {A\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {3\,A\,b^2\,\sin \left (c+d\,x\right )}{4\,d}+A\,a\,b\,x+\frac {B\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {A\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {B\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,b^2\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}+\frac {3\,B\,a\,b\,\sin \left (c+d\,x\right )}{2\,d}+\frac {A\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d}+\frac {B\,a\,b\,\sin \left (3\,c+3\,d\,x\right )}{6\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________